package com.sample.action;

import com.sample.action.form.ZcPolicyForm;
import com.sample.javabean.User;
import com.sample.javabean.ZcPolicy;
import com.sample.util.Pager;


/**
 * 政策管理类
 * @author Administrator
 *
 */
public class ZcPolicyAction extends BaseAction{
	private ZcPolicy zcPolicy=new ZcPolicy();
	private ZcPolicyForm zcPolicyForm=new ZcPolicyForm();
	private int zc_id;
	private String yzcode;
	private Pager<ZcPolicy> pageList;
	
	//构造函数
	public ZcPolicyAction() {
		super();
	}

	/**
	 * 添加政策
	 * @return
	 */
	public String inputZcPolicy(){
		return "inputZcPolicy";
	}
	public String addZcPolicy()throws Exception{
		try{
			if(zcPolicyForm!=null){
				zcPolicy.addZcPolicy(zcPolicyForm);
				return SUCCESS;
			}else{
				return "addZcPolicy";
			}
			
		}catch (Exception e) {
			 e.printStackTrace();
			 throw new Exception("Exception_bean:<--" + e+"->");
		}
	}
	
	/**
	 * 删除政策
	 * @return
	 */
	public String delZcPolicy()throws Exception{
		try{
				zcPolicy.setZc_id(zc_id);
				zcPolicy.delZcpolicy();
				return SUCCESS;
		}catch (Exception e) {
			 e.printStackTrace();
			 throw new Exception("Exception_bean:<--" + e+"->");
		}	
	}
	
	/**
	 * 编辑政策
	 * @return
	 */
	public String editZcPolicy()throws Exception{
		try{
		    zcPolicy.setZc_id(zc_id);
		    zcPolicy.load();
			return "editZcPolicy";
		}catch (Exception e) {
			 e.printStackTrace();
			 throw new Exception("Exception_bean:<--" + e+"->");
		}	
	}
	
	public String edit()throws Exception{
		try{
			if(zcPolicyForm!=null){
				zcPolicy.editZcPolicy(zcPolicyForm);		
			}
             return SUCCESS;
		}catch (Exception e) {
			 e.printStackTrace();
			 throw new Exception("Exception_bean:<--" + e+"->");
		}	
	}
	
	/**
	 * 显示政策列表
	 * @return
	 */
	public String listZcPolicy()throws Exception{
		try{
		 
			pageList=zcPolicy.list(page, size, zcPolicyForm);
			return "listZcPolicy";
		}catch (Exception e) {
			 e.printStackTrace();
			 throw new Exception("Exception_bean:<--" + e+"->");
		}
	}
	
	//属性访问方法
	public ZcPolicy getZcPolicy() {
		return zcPolicy;
	}

	public void setZcPolicy(ZcPolicy zcPolicy) {
		this.zcPolicy = zcPolicy;
	}

	public ZcPolicyForm getZcPolicyForm() {
		return zcPolicyForm;
	}

	public void setZcPolicyForm(ZcPolicyForm zcPolicyForm) {
		this.zcPolicyForm = zcPolicyForm;
	}

	

	

	public int getZc_id() {
		return zc_id;
	}

	public void setZc_id(int zc_id) {
		this.zc_id = zc_id;
	}

	public String getYzcode() {
		return yzcode;
	}

	public void setYzcode(String yzcode) {
		this.yzcode = yzcode;
	}

	public Pager<ZcPolicy> getPageList() {
		return pageList;
	}

	public void setPageList(Pager<ZcPolicy> pageList) {
		this.pageList = pageList;
	}

	

}
